package fileReader.demo.reader;

import java.awt.Graphics;
import java.util.Vector;


/**
 * The path class defines the path object used to handle easily the last results in Dijkstras
 * algorithm.
 */
class Path
{
	//Class variables
    private Vector vertexList;
    private double cost;
	
	/**
     * Constructor for the class Path.
     * In this constructor is created vertexList vector.
     *
     */
    Path()
    {
        vertexList = new Vector();
    }
	
    /**
     * This method returns a cost
     * @return cost
     */ 
    public double GetCost()
    {
        return cost;
    }

    /**
     * This method returns first element of vertexList
     * @return firstElement
     */
    public Vertex Start()
    {
        return (Vertex)vertexList.elementAt(0);
    }

    /**
     * This method returns last element of the vertexList.
     * @return lastElement
     */
    public Vertex End()
    {
        return (Vertex)vertexList.elementAt(vertexList.size() - 1);
    }

    /**
     * Returns opposite of the vertex. If parameter cvertex is on start
     * then returns end else return start.
     * @param cvertex vertex 
     * @return opposite
     */ /*
    public Vertex getOpposite(Vertex cvertex)
    {
        if(cvertex == Start())
            return End();
        else
            return Start();
    }*/

    /**
     * This method draws edge. ??
     * @param g Graphics
     * @param scale_factor scale
     * @param xtranslation translation
     * @param ytranslation translation
     * @param zoom zoom
     */
    public void Draw(Graphics g,double scale_factor,int xtranslation,int ytranslation,double zoom)
    {
        int i = vertexList.size();
        for(int j = 0; j < i - 1; j++)
        {
            Edge cedge = new Edge((Vertex)vertexList.elementAt(j), (Vertex)vertexList.elementAt(j + 1));
            cedge.Draw(g,scale_factor,xtranslation,ytranslation,zoom);
        }

    }
    
    /**
     * Returs is parameter value smaller than paths cost.
     * @param comparable value to compare
     * @return boolean true if less else false
     */ /*
    public boolean lessThan(Comparable comparable)
    {
        return cost < ((Path)comparable).cost;
    }*/
    
	/**
	 * @return Returns the vertexList.
	 */
	public Vector getVertexList() {
		return vertexList;
	}

	public void setCost(double cost) {
		this.cost = cost;
	}
}